package com.kk.base.entity.admin;

import com.kk.base.annotion.ValidateEntity;
import com.kk.base.entity.BaseEntity;
import com.kk.base.entity.home.ExpressMailOrder;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;


/**
 * 流程记录实体类
 */
@Entity
@Table(name="process_records")
@EntityListeners(AuditingEntityListener.class)
@ToString
@Data
public class ProcessRecords extends BaseEntity {

    public static final int HAVE_HANDLED = 1;//操作过

    public static final int NO_OPERATIONS = 2;//没有操作再次运输过

    @OneToOne
    @JoinColumn(name="express_mail_order_id")
    @ValidateEntity(required=true,errorRequiredMsg="订单不能为空!")
    private ExpressMailOrder expressMailOrder;  //订单

    @OneToOne
    @JoinColumn(name="received_branch_id")
    @ValidateEntity(required=true,errorRequiredMsg="发出网点不能为空!")
    private User receivedBranch;  //发出的网点

    @OneToOne
    @JoinColumn(name="next_branch_id")
    @ValidateEntity(required=true,errorRequiredMsg="下一站网站不能为空!")
    private User nextBranch; //下一个前往的网点

    @Column(name="travel_position")
    @ValidateEntity(required=true,errorRequiredMsg="接受状态不能为空!")
    private Integer travelPosition; //运输接受状态

    @Column(name = "operation")
    @ValidateEntity(required=true,errorRequiredMsg="操作状态不能为空!")
    private Integer operation = NO_OPERATIONS;

}
